import request from "@/api/config";
import { AxiosPromise } from 'axios';
import {PORT} from "@/leadmall/api/config/servicePort";
import { FileInterfixVO, FileInterfixForm, FileInterfixQuery } from '@/leadmall/api/fileInterfix/types';

/**
 * 查询附件关联列表
 * @param query
 * @returns {*}
 */

export const listFileInterfix = (query?: FileInterfixQuery): AxiosPromise<FileInterfixVO[]> => {
  return request({
    url: PORT +'/leadmall/fileInterfix/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询附件关联详细
 * @param id
 */
export const getFileInterfix = (id: string | number): AxiosPromise<FileInterfixVO> => {
  return request({
    url: PORT +'/leadmall/fileInterfix/' + id,
    method: 'get'
  });
};

/**
 * 新增附件关联
 * @param data
 */
export const addFileInterfix = (data: FileInterfixForm) => {
  return request({
    url: PORT +'/leadmall/fileInterfix',
    method: 'post',
    data: data
  });
};

/**
 * 修改附件关联
 * @param data
 */
export const updateFileInterfix = (data: FileInterfixForm) => {
  return request({
    url: PORT +'/leadmall/fileInterfix',
    method: 'put',
    data: data
  });
};

/**
 * 删除附件关联
 * @param id
 */
export const delFileInterfix = (id: string | number | Array<string | number>) => {
  return request({
    url: PORT +'/leadmall/fileInterfix/' + id,
    method: 'delete'
  });
};
